<template>
  <el-calendar v-model="currentDate" />
  <FloatingWindow
    :naviUrl="'/expire/rentexpire'"
    v-hasPermi="['zszx:rent:expire']"
    :content="'90天内有' + rentTotal + '个合同即将到期；有' + payTotal + '个合同待支付。'"
  />
</template>
<script lang="ts" setup>
import FloatingWindow from './FloatingWindow.vue'
import { RentApi } from '@/api/zszx/rent'
import { checkPermi } from '@/utils/permission'

const rentTotal = ref(0)
const payTotal = ref(0)
const currentDate = ref(new Date())
onMounted(async () => {
  if (checkPermi(['zszx:rent:expire'])) {
    rentTotal.value = await RentApi.getExpireRentCount()
    payTotal.value = await RentApi.getPayExpireRentCount()
  }
})
</script>
